package com.lantosec.hmrp.modules.warning.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.warning.vo.WarningNotifierVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <p>
 * 预警通知人 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-07-16
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WarningNotifier extends BaseEntity<WarningNotifierVO> {

    private static final long serialVersionUID = 1L;
    public WarningNotifier(WarningNotifierVO vo){
        this.warningNotifierId = vo.getWarningNotifierId();
        this.ruleId = vo.getRuleId();
        this.notifierMode = vo.getNotifierMode();
        this.notifierDeptId = vo.getNotifierDeptId();
        this.notifierPositionId = vo.getNotifierPositionId();
        this.notifierUserId = vo.getNotifierUserId();
        this.notifierRoleId = vo.getNotifierRoleId();
    }

    @Override
    public WarningNotifierVO convertToVO(){
        return new WarningNotifierVO(this);
    }


    /**
     * 主键ID
     */
    @TableId(value = "warning_notifier_id", type = IdType.AUTO)
    private Integer warningNotifierId;

    /**
     * 预警规则ID
     */
    private String ruleId;

    /**
     * 预警处置人模式(1部门 2岗位 3人员 4角色)
     */
    private Integer notifierMode;

    /**
     * 预警处置人部门ID
     */
    private String notifierDeptId;

    /**
     * 预警处置人岗位ID
     */
    private String notifierPositionId;

    /**
     * 预警处置人ID
     */
    private String notifierUserId;

    /**
     * 预警处置人角色ID
     */
    private String notifierRoleId;

    @TableField(exist = false)
    private Integer flag;

    public enum ColName {
        warning_notifier_id, rule_id, notifier_mode, notifier_dept_id, notifier_position_id, notifier_user_id, notifier_role_id, 
    }
}
